


************************************************
* Table 1: summary statistics
***********************************************
cd "D:\Nanjing\2020\wage gap\Replication"

use  "statistics_table1.dta",clear

sum absG_gdp abs_G_k tpu_ind tfp_op age kl n  finance2 rd_expense export_intensity tariff_input tariff_output kl_ind hhi5_lns_ind k_ind, d



********************************************************************************************
*********************************************************************************************




*----------------------------------------
*Table 2
*----------------------------------------

*-----------------------------------
*1.  Columns 1-2 : for matched sample
*-----------------------------------
cd "D:\Nanjing\2020\wage gap\Replication"


use "exportus_id.dta",clear
merge 1:1  id t using "labor-basic-tpu-reg-1.dta"
gen k_L=k/n
gen VMPK=capitale*(y_ind_add1/k)

bysort id: gen indc_n=_n==1
gen m_k=k if indc_n==1
bysort id: egen M_k=max(m_k)

egen p1=pctile(M_k), p(25)
egen p2=pctile(M_k), p(50)
egen p3=pctile(M_k), p(75)
gen size_k=0
replace size_k=1 if M_k<=p1
replace size_k=2 if M_k>p1&M_k<p2
replace size_k=3 if M_k>p2&M_k<p3
replace size_k=4 if M_k>p3

 bysort t indc: egen agg_l=sum(n)
 gen l_s=n/agg_l
 
*2. generate average rental rate in each category:
bysort city ind4_adj QiuType size_k t: egen r_rate=sum(l_s*VMPK) if inv>0
*bysort county ind4_adj QiuType size_k t: egen r_rate=mean(VMPK) if inv>0


* 3. gap measured in capital:

gen gdp_def=1
replace gdp_def=1.077 if t==1999
replace gdp_def=1.077*1.085 if t==2000
replace gdp_def=1.077*1.085*1.083 if t==2001
replace gdp_def=1.077*1.085*1.083*1.091 if t==2002
replace gdp_def=1.077*1.085*1.083*1.091*1.10 if t==2003
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201 if t==2004
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114 if t==2005
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114*1.127 if t==2006
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114*1.127*1.142 if t==2007

/*
gen gdp_def=1
replace gdp_def=1.063 if t==1999
replace gdp_def=1.177 if t==2000
replace gdp_def=1.302 if t==2001
replace gdp_def=1.428 if t==2002
replace gdp_def=1.819 if t==2003
replace gdp_def=1.899 if t==2004
replace gdp_def=2.198 if t==2005
replace gdp_def=2.575 if t==2006
replace gdp_def=3.170 if t==2007
*/

gen gap_k=VMPK-r_rate
gen abs_G_k=abs(gap_k)


preserve
keep if _merge==3
tabstat  absG_gdp abs_G_k tfp_op  age k_L n finance2  rd_expense export_intensity , ///
stat( mean sd ) c(s) f(%20.4f)  


*-----------------------------------------------------------------------------------
* matched sample
use "table2custom_us2000-2007ex.dta",clear
     replace Exvalue=Exvalue/120.91898
tabstat Exvalue Excountry Exproduct, stat( mean sd  ) c(s) f(%20.4f) 
 
*------------------------------------------------------------------
 
 
 
 
*-----------------------------------
*2. Columns 3-4 : for ASIP data
*-----------------------------------
 
 cd "D:\Nanjing\2020\wage gap\Replication"


use "exportus_id.dta",clear
merge 1:1  id t using "labor-basic-tpu-reg-1.dta"
gen k_L=k/n
gen VMPK=capitale*(y_ind_add1/k)

bysort id: gen indc_n=_n==1
gen m_k=k if indc_n==1
bysort id: egen M_k=max(m_k)

egen p1=pctile(M_k), p(25)
egen p2=pctile(M_k), p(50)
egen p3=pctile(M_k), p(75)
gen size_k=0
replace size_k=1 if M_k<=p1
replace size_k=2 if M_k>p1&M_k<p2
replace size_k=3 if M_k>p2&M_k<p3
replace size_k=4 if M_k>p3

 bysort t indc: egen agg_l=sum(n)
 gen l_s=n/agg_l
 
*2. generate average rental rate in each category:
bysort city ind4_adj QiuType size_k t: egen r_rate=sum(l_s*VMPK) if inv>0
*bysort county ind4_adj QiuType size_k t: egen r_rate=mean(VMPK) if inv>0


* 3. gap measured in capital:

gen gdp_def=1
replace gdp_def=1.077 if t==1999
replace gdp_def=1.077*1.085 if t==2000
replace gdp_def=1.077*1.085*1.083 if t==2001
replace gdp_def=1.077*1.085*1.083*1.091 if t==2002
replace gdp_def=1.077*1.085*1.083*1.091*1.10 if t==2003
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201 if t==2004
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114 if t==2005
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114*1.127 if t==2006
replace gdp_def=1.077*1.085*1.083*1.091*1.10*1.201*1.114*1.127*1.142 if t==2007

/*
gen gdp_def=1
replace gdp_def=1.063 if t==1999
replace gdp_def=1.177 if t==2000
replace gdp_def=1.302 if t==2001
replace gdp_def=1.428 if t==2002
replace gdp_def=1.819 if t==2003
replace gdp_def=1.899 if t==2004
replace gdp_def=2.198 if t==2005
replace gdp_def=2.575 if t==2006
replace gdp_def=3.170 if t==2007
*/

gen gap_k=VMPK-r_rate
gen abs_G_k=abs(gap_k)



tabstat  absG_gdp abs_G_k tfp_op  age k_L n finance2  rd_expense export_intensity s_ind_exp, ///
stat( mean sd ) c(s) f(%20.4f)  
 
 
 
 
 
 
 
 
 
 
 *------------------------------------------------------------------
 
 
  
*-----------------------------------
*3. Columns 5-6 : for Custom Data
*-----------------------------------
  * custom data
   cd "D:\Nanjing\2020\wage gap\Replication"

use "table2custom2000-2007ex.dta",clear
 replace Exvalue=Exvalue/120.91898
tabstat  Exvalue Excountry Exproduct, stat( mean sd min  max) c(s) f(%20.4f) 

